/*
 * FactoryTest.cpp
 *
 *  Created on: 10 nov. 2011
 *  Authors: bnoleau, cbourdieu, rlecrois
 */

#include "FactoryTest.h"

FactoryTest *FactoryTest::uniqueFactory = NULL;

FactoryTest::FactoryTest() {
	f = Factory::getInstance();
	g = NULL;
}

FactoryTest::~FactoryTest() {
	
}

FactoryTest* FactoryTest::getInstance() {
    if(uniqueFactory == NULL)
        uniqueFactory = new FactoryTest();

    return uniqueFactory;
}

Graph* FactoryTest::createGraph1() {
	g = f->createEmptyGraph();
	
	return g;
}

Graph* FactoryTest::createGraph2() {
	g = f->createGraphWithoutEdge(10);
	
	return g;
}

Graph* FactoryTest::createGraph3() {
	g = f->createGraph(10, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(0), g->nodeAt(9));
	g->createEdge(g->nodeAt(1), g->nodeAt(2));
	g->createEdge(g->nodeAt(1), g->nodeAt(3));
	g->createEdge(g->nodeAt(2), g->nodeAt(3));
	g->createEdge(g->nodeAt(2), g->nodeAt(4));
	g->createEdge(g->nodeAt(4), g->nodeAt(5));
	g->createEdge(g->nodeAt(4), g->nodeAt(9));
	g->createEdge(g->nodeAt(5), g->nodeAt(6));
	g->createEdge(g->nodeAt(5), g->nodeAt(7));
	g->createEdge(g->nodeAt(6), g->nodeAt(7));
	g->createEdge(g->nodeAt(7), g->nodeAt(8));
	g->createEdge(g->nodeAt(8), g->nodeAt(9));
	
	return g;
}

Graph* FactoryTest::createGraph4() {
	g = f->createGraph(10, 1);
	
	return g;
}

Graph* FactoryTest::createGraph5() {
	g = f->createGraph(500, 1);

	return g;
}

Graph* FactoryTest::createGraph6() {
	g = f->createGraph(5, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(1), g->nodeAt(2));
	g->createEdge(g->nodeAt(1), g->nodeAt(3));
	g->createEdge(g->nodeAt(1), g->nodeAt(4));
	g->createEdge(g->nodeAt(2), g->nodeAt(3));
	g->createEdge(g->nodeAt(3), g->nodeAt(4));

	return g;
}

Graph* FactoryTest::createGraph7() {
	g = f->createGraph(10, 0);
	g->createEdge(g->nodeAt(0), g->nodeAt(4));
	g->createEdge(g->nodeAt(1), g->nodeAt(4));
	g->createEdge(g->nodeAt(2), g->nodeAt(4));
	g->createEdge(g->nodeAt(3), g->nodeAt(4));
	g->createEdge(g->nodeAt(5), g->nodeAt(3));
	g->createEdge(g->nodeAt(5), g->nodeAt(4));
	g->createEdge(g->nodeAt(5), g->nodeAt(6));
	g->createEdge(g->nodeAt(5), g->nodeAt(7));
	g->createEdge(g->nodeAt(5), g->nodeAt(8));
	g->createEdge(g->nodeAt(5), g->nodeAt(9));
	
	return g;
}

Graph* FactoryTest::createGraph8() {
	g = f->createGraph(10, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(2));
	g->createEdge(g->nodeAt(2), g->nodeAt(1));
	g->createEdge(g->nodeAt(2), g->nodeAt(3));
	g->createEdge(g->nodeAt(2), g->nodeAt(4));
	g->createEdge(g->nodeAt(1), g->nodeAt(4));
	g->createEdge(g->nodeAt(1), g->nodeAt(5));
	g->createEdge(g->nodeAt(3), g->nodeAt(4));
	g->createEdge(g->nodeAt(3), g->nodeAt(6));
	g->createEdge(g->nodeAt(3), g->nodeAt(8));
	g->createEdge(g->nodeAt(4), g->nodeAt(5));
	g->createEdge(g->nodeAt(4), g->nodeAt(6));
	g->createEdge(g->nodeAt(5), g->nodeAt(7));
	g->createEdge(g->nodeAt(6), g->nodeAt(7));
	g->createEdge(g->nodeAt(6), g->nodeAt(9));
	g->createEdge(g->nodeAt(7), g->nodeAt(8));

	return g;
}

Graph* FactoryTest::createGraph9() {
	g = f->createGraph(2, 1);
	return g;
}

Graph* FactoryTest::createGraph10() {
	g = f->createGraph(10, 0);
	
	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(1), g->nodeAt(2));
	g->createEdge(g->nodeAt(2), g->nodeAt(3));
	g->createEdge(g->nodeAt(3), g->nodeAt(4));
	g->createEdge(g->nodeAt(4), g->nodeAt(5));
	g->createEdge(g->nodeAt(5), g->nodeAt(6));
	g->createEdge(g->nodeAt(6), g->nodeAt(7));
	g->createEdge(g->nodeAt(7), g->nodeAt(8));
	g->createEdge(g->nodeAt(8), g->nodeAt(9));
	g->createEdge(g->nodeAt(9), g->nodeAt(0));
	
	return g;
}

Graph* FactoryTest::createGraph11() {
	g = f->createGraph(10, 0);
	
	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(2), g->nodeAt(3));
	g->createEdge(g->nodeAt(4), g->nodeAt(5));
	g->createEdge(g->nodeAt(6), g->nodeAt(7));
	g->createEdge(g->nodeAt(8), g->nodeAt(9));

	return g;
}

Graph* FactoryTest::createGraph12() {
	g = f->createGraph(10, 0);
	
	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(0), g->nodeAt(2));
	g->createEdge(g->nodeAt(0), g->nodeAt(3));
	g->createEdge(g->nodeAt(1), g->nodeAt(3));
	g->createEdge(g->nodeAt(2), g->nodeAt(3));
	
	g->createEdge(g->nodeAt(4), g->nodeAt(5));
	g->createEdge(g->nodeAt(4), g->nodeAt(6));
	g->createEdge(g->nodeAt(4), g->nodeAt(7));
	g->createEdge(g->nodeAt(5), g->nodeAt(6));
	g->createEdge(g->nodeAt(5), g->nodeAt(7));
	g->createEdge(g->nodeAt(5), g->nodeAt(8));
	g->createEdge(g->nodeAt(6), g->nodeAt(8));
	g->createEdge(g->nodeAt(7), g->nodeAt(8));


	return g;
}

Graph* FactoryTest::createGraph13() {
	g = f->createGraph(4, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(0), g->nodeAt(2));
	g->createEdge(g->nodeAt(0), g->nodeAt(3));

	return g;
}

Graph* FactoryTest::createTree1() {
	g = f->createEmptyTree();

	return g;
}

Graph* FactoryTest::createTree2() {
	g = f->createTreeWithoutEdge(10);

	return g;
}

Graph* FactoryTest::createTree3() {
	g = f->createGraph(2, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(1));

	return g;
}

Graph* FactoryTest::createTree4() {
	g = f->createGraph(4, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(0), g->nodeAt(2));
	g->createEdge(g->nodeAt(0), g->nodeAt(3));

	return g;
}

Graph* FactoryTest::createTree5() {
	g = f->createGraph(7, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(0), g->nodeAt(2));
	g->createEdge(g->nodeAt(1), g->nodeAt(3));
	g->createEdge(g->nodeAt(1), g->nodeAt(4));
	g->createEdge(g->nodeAt(2), g->nodeAt(5));
	g->createEdge(g->nodeAt(2), g->nodeAt(6));

	return g;
}

Graph* FactoryTest::createTree6() {
	g = f->createGraph(11, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(0), g->nodeAt(2));
	g->createEdge(g->nodeAt(0), g->nodeAt(3));
	g->createEdge(g->nodeAt(1), g->nodeAt(4));
	g->createEdge(g->nodeAt(1), g->nodeAt(5));
	g->createEdge(g->nodeAt(2), g->nodeAt(6));
	g->createEdge(g->nodeAt(3), g->nodeAt(7));
	g->createEdge(g->nodeAt(3), g->nodeAt(8));
	g->createEdge(g->nodeAt(3), g->nodeAt(9));
	g->createEdge(g->nodeAt(8), g->nodeAt(10));

	return g;
}

Graph* FactoryTest::createTree7() {
	g = f->createGraph(14, 0);

	g->createEdge(g->nodeAt(0), g->nodeAt(1));
	g->createEdge(g->nodeAt(1), g->nodeAt(2));
	g->createEdge(g->nodeAt(2), g->nodeAt(3));
	g->createEdge(g->nodeAt(2), g->nodeAt(4));
	g->createEdge(g->nodeAt(3), g->nodeAt(5));
	g->createEdge(g->nodeAt(3), g->nodeAt(6));
	g->createEdge(g->nodeAt(3), g->nodeAt(7));
	g->createEdge(g->nodeAt(4), g->nodeAt(11));
	g->createEdge(g->nodeAt(4), g->nodeAt(8));
	g->createEdge(g->nodeAt(4), g->nodeAt(9));
	g->createEdge(g->nodeAt(4), g->nodeAt(10));
	g->createEdge(g->nodeAt(5), g->nodeAt(12));
	g->createEdge(g->nodeAt(10), g->nodeAt(13));

	return g;
}
